home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TeX 1995 July
/
TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO
/
dviware
/
dvi2qms
/
move_fonts.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-10-01
|
881b
|
40 lines
#include <stdio.h>
#include <sys/types.h>
#include <sys/dir.h>
main(argc,argv)
int argc;
char *argv[];
{
DIR *dirstream;
struct direct *dirrecord;
char *dir,qfamily[128],s[MAXNAMLEN];
int qpoint,qmag;
if (argc != 2) exit(1);
dir = argv[1];
chdir(dir);
if (dirstream = opendir(dir)) {
while (dirrecord = readdir(dirstream)) {
if (!strcmp(dirrecord->d_name+dirrecord->d_namlen-3,"pxl")) {
qpoint = -1; qmag = -1;
(void) sscanf(dirrecord->d_name,"%[^0123456789.]%d.%d",
qfamily,&qpoint,&qmag);
mkdir(qfamily,0775);
if (qpoint >= 0) {
sprintf(s,"%s%d",qfamily,qpoint);
mkdir(s,0775);
sprintf(s,"%s%d/%s",qfamily,qpoint,dirrecord->d_name);
} else {
sprintf(s,"%s",qfamily);
mkdir(s,0775);
sprintf(s,"%s/%s",qfamily,dirrecord->d_name);
}
link(dirrecord->d_name,s);
}
}
closedir(dirstream);
}
}